CFLAGS = -g -O3 -Wall
EXEC = orga
OBJ = Parser.o UnitDocument.o ShellParser.o Functions.o Index.o DynamicShellParser.o Cache.o Huffman.o HuffmanTree.o BaseNode.o Node.o LeafNode.o CodigoDelta.o NWayMerge.o registroMatrizInicial.o Query.o List.o NodeList.o

CC = g++

DIR_UNITDOCUMENT = index
DIR_PARSER = parser
DIR_SHELLPARSER = parser
DIR_DYNAMICSHELLPARSER = parser
DIR_UTILS = utils
DIR_CACHE = utils
DIR_LIST = utils
DIR_HUFFMAN = huffman
DIR_DELTA = compresores
DIR_MERGE = utils/Merge
DIR_QUERY = query

all: $(EXEC)

UnitDocument.o: $(DIR_UNITDOCUMENT)/UnitDocument.cpp $(DIR_UNITDOCUMENT)/UnitDocument.h
	$(CC) $(CFLAGS) -c $(DIR_UNITDOCUMENT)/UnitDocument.cpp

Parser.o: $(DIR_PARSER)/Parser.cpp $(DIR_PARSER)/Parser.h
	$(CC) $(CFLAGS) -c $(DIR_PARSER)/Parser.cpp

ShellParser.o: $(DIR_SHELLPARSER)/ShellParser.cpp $(DIR_SHELLPARSER)/ShellParser.h
	$(CC) $(CFLAGS) -c $(DIR_SHELLPARSER)/ShellParser.cpp

DynamicShellParser.o: $(DIR_DYNAMICSHELLPARSER)/DynamicShellParser.cpp $(DIR_DYNAMICSHELLPARSER)/DynamicShellParser.h
	$(CC) $(CFLAGS) -c $(DIR_DYNAMICSHELLPARSER)/DynamicShellParser.cpp

Functions.o: $(DIR_UTILS)/Functions.cpp $(DIR_UTILS)/Functions.h
	$(CC) $(CFLAGS) -c $(DIR_UTILS)/Functions.cpp

Index.o: $(DIR_UNITDOCUMENT)/Index.cpp $(DIR_UNITDOCUMENT)/Index.h
	$(CC) $(CFLAGS) -c $(DIR_UNITDOCUMENT)/Index.cpp

Cache.o: $(DIR_CACHE)/Cache.cpp $(DIR_CACHE)/Cache.h
	$(CC) $(CFLAGS) -c $(DIR_CACHE)/Cache.cpp

Huffman.o: $(DIR_HUFFMAN)/Huffman.cpp $(DIR_HUFFMAN)/Huffman.h
	$(CC) $(CFLAGS) -c $(DIR_HUFFMAN)/Huffman.cpp

HuffmanTree.o: $(DIR_HUFFMAN)/HuffmanTree.cpp $(DIR_HUFFMAN)/HuffmanTree.h
	$(CC) $(CFLAGS) -c $(DIR_HUFFMAN)/HuffmanTree.cpp

BaseNode.o:$(DIR_HUFFMAN)/BaseNode.cpp $(DIR_HUFFMAN)/BaseNode.h
	$(CC) $(CFLAGS) -c $(DIR_HUFFMAN)/BaseNode.cpp

Node.o:$(DIR_HUFFMAN)/Node.cpp $(DIR_HUFFMAN)/Node.h
	$(CC) $(CFLAGS) -c $(DIR_HUFFMAN)/Node.cpp

LeafNode.o:$(DIR_HUFFMAN)/LeafNode.cpp $(DIR_HUFFMAN)/LeafNode.h
	$(CC) $(CFLAGS) -c $(DIR_HUFFMAN)/LeafNode.cpp

CodigoDelta.o:$(DIR_DELTA)/CodigoDelta.cpp $(DIR_DELTA)/CodigoDelta.h
	$(CC) $(CFLAGS) -c $(DIR_DELTA)/CodigoDelta.cpp

NWayMerge.o:$(DIR_MERGE)/NWayMerge.cpp $(DIR_MERGE)/NWayMerge.h
	$(CC) $(CFLAGS) -c $(DIR_MERGE)/NWayMerge.cpp

registroMatrizInicial.o:$(DIR_MERGE)/registroMatrizInicial.cpp $(DIR_MERGE)/registroMatrizInicial.h
	$(CC) $(CFLAGS) -c $(DIR_MERGE)/registroMatrizInicial.cpp

Query.o:$(DIR_QUERY)/Query.cpp $(DIR_QUERY)/Query.h
	$(CC) $(CFLAGS) -c $(DIR_QUERY)/Query.cpp

List.o:$(DIR_LIST)/List.cpp $(DIR_LIST)/List.h
	$(CC) $(CFLAGS) -c $(DIR_LIST)/List.cpp

NodeList.o:$(DIR_LIST)/NodeList.cpp $(DIR_LIST)/NodeList.h
	$(CC) $(CFLAGS) -c $(DIR_LIST)/NodeList.cpp



$(EXEC): $(OBJ) main.cpp
	$(CC) $(OBJ) main.cpp -o $(EXEC) $(CFLAGS)

clean:
	rm -rf $(OBJ) $(EXEC) && rm -rf ./salidas/Merge/* ./salidas/* ./IndiceFinal/*
